using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.IO;

namespace yasaCS
{
    class YASAWrapper
    {
        [DllImport(@"..\..\..\debug\yasadll.dll", EntryPoint = "getTF", SetLastError = true)]
        public static extern int getTF(string file, int utf8_enable, int max_length, out IntPtr out_ptr);
        public int DoSuffix(string filepath, int type, int max_len, out string outUTF8Str)
        {
            IntPtr outStr;
            int ret = getTF(filepath, type, max_len, out outStr);  // type!=0  => utf8 mode 
            outUTF8Str = Encoding.UTF8.GetString(Encoding.Unicode.GetBytes(Marshal.PtrToStringAuto(outStr)));
            return ret;
        }
    }
}
